import os
import sys
import ts_env

import ts_vim

__env_mgr = ts_env.EnvManager()

def __env_input_list():
	env_list = __env_mgr.get_env_list()
	env_index = ts_vim.input_list('Environment name', env_list)
	if env_index == -1:
		return 
	return env_list[env_index]

def env_push(is_merged = False):
	env_name = __env_input_list()
	if env_name:
		__env_mgr.push(env_name, is_merged)
		print 'Switched to %s environment' % env_name

def env_pop():
	__env_mgr.pop()
	print 'Environment restored' 

if __name__ == '__main__':
	pass
